#ifndef SERVERCONEXION_H_
#define SERVERCONEXION_H_

#include <string>
#include "Conexion.h"
#include "Socket.h"

using namespace std;

class ConexionServer : public virtual Conexion{
protected:
	Socket *socket;
public:
	ConexionServer();
	virtual ~ConexionServer();
	bool listen(const unsigned int port, const unsigned int maxClientes);
	/* Implementar accept en lases derivadas con
	ConexionServer* ConexionServer::accept(){
	Socket* pSocket = this->socket->accept();

	if(pSocket != NULL){
		ConexionServer *server = new ConexionServer(pSocket);
		return server;
		} else {
		return NULL;
		}
	}
	 */
	ConexionServer* accept();
	bool getConectado();

	virtual bool enviar(const string &s) const = 0;
	virtual bool recibir(string &s) const = 0;
	virtual bool shutdownAndClose();

private:
	ConexionServer(Socket *socket);
};

#endif /* SERVERCONEXION_H_ */
